//
//  NSString+ExtenSion.m
//  DianBo
//
//  Created by 杨波 on 2017/9/6.
//  Copyright © 2017年 微光. All rights reserved.
//

#import "NSString+ExtenSion.h"
#import "UIApplication+Extension.h"




@implementation NSString (ExtenSion)


+(UINavigationController*)backSeletNaiVC{
    id root = [UIApplication getKeyWindow].rootViewController;
    if ([root isKindOfClass:[UITabBarController class]]) {
        UITabBarController * rootTabbar = (UITabBarController*)root;
        id seletVc = rootTabbar.selectedViewController;
        if ([seletVc isKindOfClass:[UINavigationController class]]) {
            UINavigationController * navc = (UINavigationController*)seletVc;
            return navc;
        }
    }else if ([root isKindOfClass:[UINavigationController class]]) {
        UINavigationController * navc = (UINavigationController*)root;
        return navc;
    }else if ([root isKindOfClass:[UIViewController class]]) {
        UIViewController * viewController = (UINavigationController*)root;
        if (viewController.navigationController) {
            return viewController.navigationController;
        }
    }
    return nil;
}


@end
